package cn.iocoder.yudao.module.scrm.dal.mysql.receivable;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.scrm.dal.dataobject.receivable.ReceivableDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.scrm.controller.admin.receivable.vo.*;

/**
 * 回款 Mapper
 *
 * @author admin
 */
@Mapper
public interface ReceivableMapper extends BaseMapperX<ReceivableDO> {

    default PageResult<ReceivableDO> selectPage(ReceivablePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReceivableDO>()
                .likeIfPresent(ReceivableDO::getNo, reqVO.getNo())
                .eqIfPresent(ReceivableDO::getOrderId, reqVO.getOrderId())
                .inIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
                .betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getStartDate(), reqVO.getEndDate())
                .eqIfPresent(ReceivableDO::getAuditStatus,reqVO.getAuditStatus())
                .orderByDesc(ReceivableDO::getId));

    }

}